package com.ruoyi.web.controller.edh;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.IssueLogConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.edh.service.IEdhIssueLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 易订货-学院发布内容操作记录Controller
 *
 * @author xxx
 * @date 2020-09-02
 */
@RestController
@RequestMapping("/edh/issuelog")
@Api(description = "学院发布内容---分享/点爱心")
public class EdhIssueLogController extends BaseController {
    @Autowired
    private IEdhIssueLogService edhIssueLogService;

    @GetMapping("/share")
    @Log(title = "分享学院内容", businessType = BusinessType.UPDATE)
    @ApiOperation("学院内容分享")
    @ApiImplicitParam(name = "issueId", value = "学院内容id", required = true, dataType = "Long")
    public AjaxResult share(Long issueId) {
        edhIssueLogService.recordLog(issueId, IssueLogConstants.SHARE);
        return AjaxResult.success("分享" + issueId + "成功");
    }

    @GetMapping("/kindness")
    @Log(title = "给学院内容点爱心", businessType = BusinessType.UPDATE)
    @ApiOperation("给学院内容点爱心")
    @ApiImplicitParam(name = "issueId", value = "学院内容id", required = true, dataType = "Long")
    public AjaxResult kindness(Long issueId) {
        int i = edhIssueLogService.recordLog(issueId, IssueLogConstants.KINDNESS);
        return AjaxResult.success(0 == i ? "您回收了一个爱心" : "您点了一个爱心");
    }

}
/* *//**
 * 查询易订货-学院发布内容操作记录列表
 * <p>
 * 导出易订货-学院发布内容操作记录列表
 * <p>
 * 获取易订货-学院发布内容操作记录详细信息
 * <p>
 * 新增易订货-学院发布内容操作记录
 * <p>
 * 修改易订货-学院发布内容操作记录
 * <p>
 * 删除易订货-学院发布内容操作记录
 *//*
    @PreAuthorize("@ss.hasPermi('system:log:list')")
    @GetMapping("/list")
    @ApiOperation("易订货-学院发布内容操作记录列表")
    public TableDataInfo list(EdhIssueLog edhIssueLog)
    {
        startPage();
        List<EdhIssueLog> list = edhIssueLogService.selectEdhIssueLogList(edhIssueLog);
        return getDataTable(list);
    }

    *//**
 * 导出易订货-学院发布内容操作记录列表
 *//*
    @PreAuthorize("@ss.hasPermi('system:log:export')")
    @Log(title = "易订货-学院发布内容操作记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
	@ApiOperation("导出易订货-学院发布内容操作记录列表")
    public AjaxResult export(EdhIssueLog edhIssueLog)
    {
        List<EdhIssueLog> list = edhIssueLogService.selectEdhIssueLogList(edhIssueLog);
        ExcelUtil<EdhIssueLog> util = new ExcelUtil<EdhIssueLog>(EdhIssueLog.class);
        return util.exportExcel(list, "log");
    }

    *//**
 * 获取易订货-学院发布内容操作记录详细信息
 *//*
    @PreAuthorize("@ss.hasPermi('system:log:query')")
    @GetMapping
	@ApiOperation("获取易订货-学院发布内容操作记录详细信息")
    public AjaxResult getInfo(Long id)
    {
        return AjaxResult.success(edhIssueLogService.selectEdhIssueLogById(id));
    }

    *//**
 * 新增易订货-学院发布内容操作记录
 *//*
    @PreAuthorize("@ss.hasPermi('system:log:add')")
    @Log(title = "易订货-学院发布内容操作记录", businessType = BusinessType.INSERT)
    @PostMapping
	@ApiOperation("新增易订货-学院发布内容操作记录")
    public AjaxResult add(@RequestBody EdhIssueLog edhIssueLog)
    {
        return toAjax(edhIssueLogService.insertEdhIssueLog(edhIssueLog));
    }

    *//**
 * 修改易订货-学院发布内容操作记录
 *//*
    @PreAuthorize("@ss.hasPermi('system:log:edit')")
    @Log(title = "易订货-学院发布内容操作记录", businessType = BusinessType.UPDATE)
    @PutMapping
	@ApiOperation("修改易订货-学院发布内容操作记录")
    public AjaxResult edit(@RequestBody EdhIssueLog edhIssueLog)
    {
        return toAjax(edhIssueLogService.updateEdhIssueLog(edhIssueLog));
    }

    *//**
 * 删除易订货-学院发布内容操作记录
 *//*
    @PreAuthorize("@ss.hasPermi('system:log:remove')")
    @Log(title = "易订货-学院发布内容操作记录", businessType = BusinessType.DELETE)
	@DeleteMapping
	@ApiOperation("删除易订货-学院发布内容操作记录")
    public AjaxResult remove( Long[] ids)
    {
        return toAjax(edhIssueLogService.deleteEdhIssueLogByIds(ids));
    }*/

